<?php
//Ten file muon xuat ra de in
$v_recordtype_filter = "";
if(isset($_REQUEST['hdn_recordtype_filter'])){
	$v_recordtype_filter = $_REQUEST['hdn_recordtype_filter'];
} 
$v_file_name = "noi_dung_giay_phep.htm";
$v_xml_str = $arr_single_record['C_RECEIVED_RECORD_XML_DATA'];
//file chua cac the can thay the
$v_receipt_xml_file = "../../xml/".$v_recordtype_filter."/mau_in_don.xml";
if (file_exists($v_receipt_xml_file)){
	$v_receipt_xml_string = _read_file($v_receipt_xml_file);
}else{
	echo "<Center><B>H&#7878; TH&#7888;NG KH&#212;NG T&#204;M TH&#7844;Y M&#7850;U V&#258;N B&#7842;N TR&#7842; K&#7870;T QU&#7842; C&#7846;N IN</B></Center>";
	exit;
}
$table_struct_rax = new RAX(); 
$table_struct_rec = new RAX(); 
$table_struct_rax->open($v_receipt_xml_string);
$table_struct_rax->record_delim = 'application_form';
$table_struct_rax->parse();
$table_struct_rec = $table_struct_rax->readRecord(); 
$table_struct_row = $table_struct_rec->getRow();
$v_file_name = $table_struct_row["file_name"];
$v_receipt_richtext_file = "../../template/".$v_file_name;
$v_receipt_richtext_string = _read_file($v_receipt_richtext_file);
$v_richtext_output = Print_Receipt_From_XML($v_receipt_xml_string,$v_receipt_richtext_string,$v_xml_str,$arr_single_record);
_write_file($v_file_name,$v_richtext_output);
?>
<script language="javascript">
	window.location = "<?php echo $v_file_name;?>";
</script>